package com.wangxiang.shop.member.data;

import com.wangxiang.common.utils.DataEntity;
import com.wangxiang.common.utils.R;
import com.wangxiang.shop.member.entity.MemberEntity;
import com.wangxiang.shop.member.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("member/data")
public class DataController {
    @Autowired
    private MemberService memberService;

    @RequestMapping("sex")
    public R sexData(){
        List<DataEntity> list = memberService.sexData();
//        System.out.println(list);
        return R.ok().put("list",list);
    }
    @RequestMapping("age")
    public R ageData(){
        List<DataEntity> list = memberService.ageData();
        return R.ok().put("list",list);
    }

    @RequestMapping("location")
    public R location(){
        List<DataEntity> list = memberService.locationData();
        return R.ok().put("list",list);
    }

    @RequestMapping("numInfo")
    public R numInfo(){
        HashMap<String, Integer> map = memberService.numInfo();
//        System.out.println("数据"+map);
        return R.ok().put("map",map);
    }


}
